package com.enation.app.javashop.api.client;

import com.enation.app.javashop.model.orderbill.dos.BillItem;
import com.enation.app.javashop.service.orderbill.BillItemManager;
import com.enation.app.javashop.service.orderbill.BillManager;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;
import java.util.Map;

/**
 * @author fk
 * @version v2.0
 * @Description: 结算对外client
 * @date 2018/7/30 15:06
 * @since v7.0.0
 */
@RestController
@RequestMapping("/client/bills")
@Validated
@ApiIgnore
public class BillClientController {

    @Autowired
    private BillManager billManager;

    @Autowired
    private BillItemManager billItemManager;

    @GetMapping("/create")
    public void createBills(@RequestParam("start_time") Long startTime, @RequestParam("end_time")Long endTime){

        this.billManager.createBills(startTime,endTime);

    }

    @PostMapping("/items")
    public BillItem add(@RequestBody BillItem billItem){

        return this.billItemManager.add(billItem);
    }

}
